import pymysql

# 连接数据库
db = pymysql.connect(
    host="localhost",
    user="root",
    port=3306,
    database="crawlerdemo",
    password="1201",
    charset="utf8"
)
cursor = db.cursor()
cursor.execute("select * from m_stu")
print(cursor)
data=cursor.fetchall()

print(data)
cursor.close()
db.close()

